{{csrf_field()}}

<div class="layui-form-item layui-col-md6">
    <label for="" class="layui-form-label">账号</label>
    <div class="layui-input-block">
        <input type="text" name="username" value="{{ $data['username'] ?? '' }}" lay-verify="required" placeholder="请输入账号" class="layui-input" >
    </div>
</div>
<div class="layui-form-item layui-col-md6">
    <label for="" class="layui-form-label">密码</label>
    <div class="layui-input-block">
        <input type="password" name="password" value="" @if(!isset($data)) lay-verify="required" @endif placeholder="请输入密码" class="layui-input" >
    </div>
</div>
<div class="layui-form-item layui-col-md6">
    <label for="" class="layui-form-label">确认密码</label>
    <div class="layui-input-block">
        <input type="password" name="repassword" value="" @if(!isset($data)) lay-verify="required" @endif placeholder="请输入确认密码" class="layui-input" >
    </div>
</div>
<div class="layui-form-item layui-col-md6">
    <label for="" class="layui-form-label">姓名</label>
    <div class="layui-input-block">
        <input type="text" name="realname" value="{{ $data['realname'] ?? '' }}" lay-verify="required" placeholder="请输入姓名" class="layui-input" >
    </div>
</div>
<div class="layui-form-item layui-col-md6">
    <label for="" class="layui-form-label">电话</label>
    <div class="layui-input-block">
        <input type="text" name="phone" value="{{ $data['phone'] ?? '' }}" lay-verify="required" placeholder="请输入电话" class="layui-input" >
    </div>
</div>
<div class="layui-form-item layui-col-md6">
    <label for="" class="layui-form-label">人员角色</label>
    <div class="layui-input-block">
        <select name="role" xm-select="role" xm-select-radio xm-select-search="">
            @foreach (getRoleList() as $id => $name)
                <option value="{{$id ?? 0}}" {{(isset($data) && $data->role == $id) ? 'selected' : ''}}>{{$name ?? ''}}</option>
            @endforeach
        </select>
    </div>
</div>

<div class="layui-form-item">
    <label for="" class="layui-form-label">状态</label>
    <div class="layui-input-block">
        <input type="checkbox" name="status" lay-skin="switch" lay-text="开启|关闭" @if( !isset($data['status']) || $data['status'] != 2 ) checked @endif >
    </div>
</div>

<div class="layui-form-item">
    <div class="layui-input-block">
        {{isset($data) ? method_field('PUT') : ''}}
        {{csrf_field()}}
        <button type="submit" class="layui-btn" lay-submit="" lay-filter="layui-form-submit">确 认</button>
        <a  class="layui-btn" href="/admin/adminer" >返 回</a>
    </div>
</div>

